package experiment.e05.code.ch04.v0;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/10/13 16:01
 * @package experiment.e05.code.ch04.v0
 * @description 圆类
 */
public class Circle extends Point {
    // 实例变量 ： 半径
    private double radius;

    // 构造方法
    public Circle() {
    }

    public Circle(double radius) {
        this.radius = radius;
    }

    // set && get
    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    /**
     * 获取面积
     *
     * @return
     */
    public double getArea() {
        return radius * Math.PI * radius;
    }

    /**
     * 输出坐标信息 和 半径信息
     *
     * @return
     */
    @Override
    public String toString() {
        return "Circle:{" + "radius=" + radius + ", " + super.toString() + "}";
    }
}
